﻿/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2012-2018. All rights reserved.
 * Description:
 * Author: 辛爱国 x30005137
 * Create: 2020-07-28
 * Notes: 无
 */
#pragma once
#include <QEvent>
#include <QSystemTrayIcon>
#include <QVBoxLayout>
#include <QMenu>
#include <QWidget>
#include <QPushButton>
#include "HWDialog.h"

enum TheFiveButtonType {
    Connect, // 连接状态
    Share,   // 分享状态
    Stop,    // 停止分享
    ShareAudio, // 共享音频
    StopShareAudio, // 停止共享音频
};

class TrayIcon : public QSystemTrayIcon, public CommenMethod {
    Q_OBJECT
public:
    TrayIcon(const QString &Name, QWidget *parent = nullptr, const int &MenuCount = 4);
    ~TrayIcon();
    bool MenuisVisible();
    void hideMenu();
    void init();
    virtual bool eventFilter(QObject *watched, QEvent *event);
    void LeaveFun(QObject *watched, QEvent *event);
    void EnterFun(QObject *watched, QEvent *event);
public slots:
    void slotExit();
    void slotConnect();
    void slotCollectLog();
    void slotAbout();
    void slotSetting();

#if defined(IDEASHAREKEY)
    void showButtonName(const TheFiveButtonType &status);
#endif
private:
    QPushButton *createPushbutton(const QString &Name, const QString &text, QSize size, double rate = 1.0);
    QMenu *m_menu { nullptr };
    QVBoxLayout *m_vlayout { nullptr };
    QWidget *m_parent { nullptr };
    int m_MenuCount = 0;
    TheFiveButtonType m_curStatus;
    QPushButton *m_button { nullptr };
};
